#!/bin/sh
##########################################################################
# This file is part of Hawkengine.
#
# Hawkengine is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Hawkengine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Hawkengine.  If not, see <http://www.gnu.org/licenses/>.
##########################################################################

GENERATED_FILE="// Auto-Generated -- DO NOT EDIT"

# hawkengine.hrh
HRH=$SYMBIAN_PROJECT_DIR/inc/hawkengine.hrh
echo "$GENERATED_FILE" > $HRH
echo "#ifndef _HAWKENGINE_HRH_" >> $HRH
echo "#define _HAWKENGINE_HRH_" >> $HRH
echo "#define _UID3 $SYMBIAN_UID" >> $HRH
echo "#endif" >> $HRH

# *.rss
RSS=$SYMBIAN_PROJECT_DIR/data/$SYMBIAN_TARGET.rss
echo "$GENERATED_FILE" > $RSS
echo "#include <eikon.rh>" >> $RSS
echo "NAME BKHK" >> $RSS
echo "RESOURCE RSS_SIGNATURE {}" >> $RSS
echo "RESOURCE TBUF {}" >> $RSS
echo "RESOURCE EIK_APP_INFO {}" >> $RSS

# *_reg.rss
REG_RSS_EXT=_reg.rss
REG_RSS=$SYMBIAN_PROJECT_DIR/data/$SYMBIAN_TARGET$REG_RSS_EXT
echo "$GENERATED_FILE" > $REG_RSS
echo "#include \"hawkengine.hrh\"" >> $REG_RSS
echo "#include <appinfo.rh>" >> $REG_RSS
echo "UID2 KUidAppRegistrationResourceFile" >> $REG_RSS
echo "UID3 _UID3" >> $REG_RSS
echo "" >> $REG_RSS
echo "RESOURCE APP_REGISTRATION_INFO" >> $REG_RSS
echo "{" >> $REG_RSS
echo "  app_file = \"$SYMBIAN_TARGET\";" >> $REG_RSS
echo "}" >> $REG_RSS

# mmp file
MMP=$SYMBIAN_PROJECT_DIR/group/$SYMBIAN_MMP_NAME
echo preparing $MMP_NAME...
echo "$GENERATED_FILE" > $MMP
echo "TARGET	$SYMBIAN_TARGET.exe" >> $MMP
echo "TARGETTYPE	exe" >> $MMP
echo "UID		  0x100039CE $SYMBIAN_UID" >> $MMP
echo "" >> $MMP
echo "SOURCEPATH	$SYMBIAN_SOURCEPATH" >> $MMP
for SOURCE in $SYMBIAN_SOURCE; do
    echo "SOURCE	$SOURCE" >> $MMP
done
echo "" >> $MMP
for MACRO in $SYMBIAN_MACROS; do
    echo "MACRO	$MACRO" >> $MMP
done
echo "" >> $MMP
for USERINCLUDE in $SYMBIAN_USERINCLUDE; do
    echo "USERINCLUDE	$USERINCLUDE" >> $MMP
done
echo "" >> $MMP
for SYSTEMINCLUDE in $SYMBIAN_SYSTEMINCLUDE; do
    echo "SYSTEMINCLUDE	$SYSTEMINCLUDE" >> $MMP
done

echo "" >> $MMP
echo "START RESOURCE $RSS" >> $MMP
echo "HEADER" >> $MMP
echo "TARGETPATH	\Resource\Apps" >> $MMP
echo "END" >> $MMP

echo "" >> $MMP
echo "START RESOURCE $REG_RSS" >> $MMP
echo "#ifdef WINSCW" >> $MMP
echo "TARGETPATH	\private\10003a3f\apps" >> $MMP
echo "#else" >> $MMP
echo "TARGETPATH	\private\10003a3f\import\apps" >> $MMP
echo "#endif" >> $MMP
echo "END" >> $MMP

echo "" >> $MMP
echo "LIBRARY	$SYMBIAN_LIBRARY" >> $MMP
echo "" >> $MMP
echo "VENDORID	0" >> $MMP
echo "SECUREID	$SYMBIAN_UID" >> $MMP
echo "CAPABILITY	ReadUserData" >> $MMP
echo "" >> $MMP

# bld.inf
BLD_INF=$SYMBIAN_PROJECT_DIR/group/bld.inf
echo preparing bld.inf
echo "$GENERATED_FILE" > $BLD_INF
echo "PRJ_PLATFORMS" >> $BLD_INF
echo "DEFAULT $SYMBIAN_PLATFORMS" >> $BLD_INF
echo "" >> $BLD_INF
echo "PRJ_MMPFILES" >> $BLD_INF
echo "$SYMBIAN_MMP_NAME" >> $BLD_INF
echo "" >> $BLD_INF

